package great.project.service.stroge;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;

/**
 * <div  style="border:2px solid none;margin:20px;padding:15px;font-size:24px;text-align:center;color:aqua;">
 *
 *
 *
 *  </div>
 *
 * @author zhangshun
 * @date 2021/2/25 10:02
 */
public abstract class AbstractStrategyService<T,K> {


    private Map<String, T> beanMap;

    /**
     *  策略服务
     * @return 结果
     */
    public abstract BiFunction<Map<String, T>, K , T> strategyService();

    public T strategy(K k) {
        return strategyService().apply(beanMap , k);
    }

    @Autowired
    void setBeanMap(Map<String, T> beanMap) {
        this.beanMap = beanMap;
    }
}
